package cur.nature.component.nacos.handler;//package com.ibank.component.nacos.handler;
//
//import com.ibank.framework.core.log.LOG;
//import org.springframework.http.client.ClientHttpResponse;
//import org.springframework.web.client.ResponseErrorHandler;
//import org.springframework.web.server.ResponseStatusException;
//
//import java.io.IOException;
//
//public class CustomResponseErrorHndler implements ResponseErrorHandler {
//
//    @Override
//    public boolean hasError(ClientHttpResponse response) throws IOException {
//        return response.getStatusCode().is4xxClientError() || response.getStatusCode().is5xxServerError();
//    }
//
//    @Override
//    public void handleError(ClientHttpResponse response) throws IOException {
//        LOG.info("处理异常: " + response.getStatusCode());
//        if (response.getStatusCode().is4xxClientError()) {
//            throw  new RuntimeException("客户端错误: "+response.getStatusCode() +","+response.getStatusText());
//        } else if (response.getStatusCode().is5xxServerError()) {
//            throw  new RuntimeException("服务端错误: "+response.getStatusCode() +","+response.getStatusText());
//        }
//    }
//}
